import 'package:aichat_flutter_wallet/module/module_browser/widget/common_widget.dart';
import 'package:aichat_flutter_wallet/module_common/utils/colors.dart';
import 'package:aichat_flutter_wallet/module_common/widgets/button/bottom_button.dart';
import 'package:aichat_flutter_wallet/module_common/widgets/dialog/bottom_sheet_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../../kai_print.dart';

class TransferAuthorizetionWidget extends StatefulWidget {
  const TransferAuthorizetionWidget({super.key});

  @override
  State<TransferAuthorizetionWidget> createState() => _TransferAuthorizetionWidgetState();
}

class _TransferAuthorizetionWidgetState extends State<TransferAuthorizetionWidget> {
  @override
  Widget build(BuildContext context) {
    return BottomSheetWidget(
      expand: false,
      title: 'Transfer Authorization',
      child: Padding(
        padding: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.w),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            CommonWidgetUtil.websizeWidget(title: 'Dmail Network', subTitle: 'https://dmail.ai/'),
            SizedBox(
              height: 10.w,
            ),
            Text(
              'Number of Transfer Authorization Requests',
              style: TextStyle(color: AppColors.c_333333, fontSize: 14.sp, fontWeight: FontWeight.w600),
            ),
            SizedBox(
              height: 10.w,
            ),
            Padding(
              padding: EdgeInsets.only(
                left: 15.w,
              ),
              child: CommonWidgetUtil.walletCoinInfoWidget(),
            ),
            SizedBox(
              height: 10.w,
            ),
            CommonWidgetUtil.textWidget(
                'Attention! Granting this permission will give the contract access to transfer your %XXX% If this contract is malicious, there is a risk of theft. Please ensure that the current connection is trustworthy!',
                color: AppColors.c_868391,
                fontsize: 12.sp),
            SizedBox(
              height: 10.w,
            ),
            CommonWidgetUtil.contentItemWidget('From', Text('0x1gfq…..aaas')),
            SizedBox(
              height: 10.w,
            ),
            CommonWidgetUtil.contentItemWidget('To', Text('0x1gfq…..aaas')),
            SizedBox(
              height: 10.w,
            ),
            CommonWidgetUtil.contentItemWidget('Contract Address', Text('0x1gfq…..aaas')),
            SizedBox(
              height: 10.w,
            ),
            CommonWidgetUtil.contentItemWidget('Gas Fee', Text("0.01ETH(\$16.54)")),
            SizedBox(
              height: 10.w,
            ),
            CommonWidgetUtil.contentItemWidget('Contract Method', Text('Commit')),
            SizedBox(
              height: 20.w,
            ),
            Text(
              'Authorization Amount',
              style: TextStyle(color: AppColors.c_333333, fontSize: 14.sp, fontWeight: FontWeight.w600),
            ),
            SizedBox(
              height: 10.w,
            ),
            CommonWidgetUtil.tokenInputWidget(
                canInput: true,
                onChange: (value) {
                  kaiPrint('value===${value}');
                }),
            SizedBox(
              height: 20.w,
            ),
            BottomBtn(
              textList: ['Cancel', 'Confirm'],
              onConfirm: () {
                kaiPrint('comfirm');
              },
            )
          ],
        ),
      ),
    );
  }
}
